name = 'script-test';

function ro_test_method(request)
{
    return [FinishedSuccessfully, XML("ok")];
}

ro_test_method.description = 'Script Test Method';

////////////////////////////////////////////////////////////////////////////////

function racceptor(error, answer)
{
    if ( error )
    {
        print("Error from " + this.component + '::' + this.method + ' (' + this.rid + '):\n' + answer);
    }
    else
    {
        print("Success from " + this.component + '::' + this.method + ' (' + this.rid + '):\n' + answer);
    }

    if ( activeQueriesCount == 1 ) // обрабатывается последний ответ
        quit();
}

query('ROUTER::query-components', {resultAcceptor: racceptor});

query('dir::ls', {
    argument: XML('<path>/</path>'),
    dataAcceptor: function(datum)
    {
        print("Datum from " + this.component + '::' + this.method + ' (' + this.rid + '):\n' + datum);
    },
    resultAcceptor: racceptor
});

query(name + '::query-interface', {resultAcceptor: racceptor});

query(name + '::test-method', {resultAcceptor: racceptor});
